/* eslint-disable camelcase */
/*
 * @Description:
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2023-07-04 07:26:34
 * @LastEditors: zss
 * @LastEditTime: 2024-05-27 15:47:15
 */
import { T_srv, Tsrv, ifs, ts, tvs, vue } from '@/services';
import { N_oSimpleToolbar } from '@/types';
import { I_cmd, Tcmd } from './command/command';
import { N_cpms } from './types';

const actToolbarConf = (): Array<N_oSimpleToolbar.I_Conf> => {
  return [
    {
      key: 'selectAll',
      type: 'button',
      class: 'wy-select-all',
      title: '全布权限',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'unSelectAll',
      type: 'button',
      class: 'wy-delete-all',
      title: '取消所有选择',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'cpFromRole',
      type: 'button',
      class: 'wy-fuzhi',
      title: '从角色复制',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'refresh',
      type: 'button',
      class: 'wy-shuaxin',
      title: '刷新',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'save',
      type: 'button',
      class: 'wy-baocun41',
      title: '保存',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    }
  ];
};
const funToolbarConf = (): Array<N_oSimpleToolbar.I_Conf> => {
  return [
    {
      key: 'add',
      type: 'button',
      class: 'wy-insert',
      title: '增加功能',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: false,
      separator: false
    },

    {
      key: 'cpFromRole',
      type: 'button',
      class: 'wy-fuzhi',
      title: '从角色复制',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'refresh',
      type: 'button',
      class: 'wy-shuaxin',
      title: '刷新',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'save',
      type: 'button',
      class: 'wy-baocun41',
      title: '保存',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: true
    },
    {
      key: 'reset',
      type: 'button',
      class: 'wy-cancel-audit',
      title: '重置所有功能',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: false,
      separator: true,
      color: 'red'
    },
    {
      key: 'delete',
      type: 'button',
      class: 'wy-delete',
      title: '删除',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: true,
      color: '#f30'
    },
    {
      key: 'refreshCache',
      type: 'button',
      class: 'wy-zhuangbeizhizao',
      title: '刷新缓存',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: false,
      separator: false,
      color: '#a24d92'
    }
  ];
};
const getRoleConf = () => {
  return {
    name: '_sys_role',
    comment: '',
    status: 'main',
    isCreated: false,
    tableStyle: {
      showHeader: true,
      showFooter: false,
      showPager: true,
      showToolbar: true,
      border: false
    },
    tableColumns: [
      {
        fieldID: '222301287968935937',
        field: 'title',
        type: 'varchar(45)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: {
          dochange: false
        },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: true,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '223627198026747904',
        field: '_sys_account_set_id',
        type: 'bigint(20)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: {
          dochange: false
        },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '_sys_account_set',
          toField: 'f_name',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222301287968935965',
        field: 'f_comment',
        type: 'varchar(200)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: {
          dochange: ''
        },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      }
    ],
    uniqueIndexes: [
      [
        {
          id: '222301287968935979',
          name: 'obj_id'
        },
        {
          id: '223627198026747904',
          name: '_sys_account_set_id'
        }
      ]
    ],
    indexes: [],
    rules: [],
    selbill: [],
    queryLink: [],
    action: {},
    headerGroup: [],
    charts: [],
    toolbar: {
      default: true,
      insert: true,
      delete: true,
      save: true,
      import: true,
      export: true,
      globalSearch: true,
      refresh: true,
      edit: true,
      print: true,
      audit: false,
      pasteColumn: false,
      addon: []
    },
    tableDataSetting: {
      editable: true,
      autoload: true
    },
    messageConfig: {
      custDefListener: {
        coordination: '3ab7c471-aa04-11ee-906b-0a2c9e079216'
      },
      eventGroup: {},
      emitActions: {
        search: [
          {
            toID: '_sys_roleobj_funs',
            msg: {
              type: 'search',
              content: {
                ikey: 'id',
                ukey: '_sys_role_id',
                val: ''
              }
            }
          }
        ],
        refresh: []
      }
    },
    actions: {},
    dbType: 'mysql',
    permission: [
      {
        type: 'button',
        area: 'toolbar',
        data: {
          audit: 1,
          delete: 1,
          edit: 1,
          export: 1,
          import: 1,
          insert: 1,
          pasteColumn: 1,
          print: 1,
          save: 1,
          unaudit: 1
        }
      },
      {
        type: 'NULL',
        area: 'default',
        data: {
          browse: 1
        }
      },
      {
        type: 'columns',
        area: 'table',
        data: {
          f_comment: 1,
          title: 1,
          _sys_account_set_id: 1
        }
      }
    ]
  };
};

// const getRoleFunRuleConf = () => {
//   return {
//     name: '_sys_roleobj_funs_rule',
//     comment: '',
//     status: '',
//     isCreated: false,
//     tableStyle: {
//       showHeader: true,
//       showFooter: false,
//       showPager: true,
//       showToolbar: true,
//       border: false
//     },
//     tableColumns: [
//       {
//         fieldID: '222301287968935982',
//         field: '_sys_roleobj_funs_id',
//         type: 'bigint(20)',
//         isShow: false,
//         notNull: true,
//         defValue: '',
//         comment: '',
//         selectionID: null,
//         disabled: true,
//         defaultFilter: false,
//         footerMethod: null,
//         formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
//         actions: { dochange: false },
//         auxProp: '',
//         minWidth: '',
//         appWeight: '',
//         isDes: false,
//         many2one: {
//           toTable: '_sys_roleobj_funs',
//           toField: '_sys_fun_id',
//           isDropdown: false,
//           customSearch: '',
//           multiConnect: '',
//           fields: []
//         },
//         align: 'left',
//         subQuery: ''
//       },
//       {
//         fieldID: '222301287968935985',
//         field: '_sys_pms_rule_id',
//         type: 'bigint(20)',
//         isShow: true,
//         notNull: true,
//         defValue: '',
//         comment: '',
//         selectionID: null,
//         disabled: true,
//         defaultFilter: false,
//         footerMethod: null,
//         formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
//         actions: { dochange: false },
//         auxProp: '',
//         minWidth: '',
//         appWeight: '',
//         isDes: false,
//         many2one: {
//           toTable: '_sys_pms_rule',
//           toField: 'title',
//           isDropdown: false,
//           customSearch: '',
//           multiConnect: '',
//           fields: []
//         },
//         align: 'left',
//         subQuery: ''
//       },
//       {
//         fieldID: '222308141738496005',
//         field: 'f_enabled',
//         type: 'bit(1)',
//         isShow: true,
//         notNull: false,
//         defValue: '0',
//         comment: '',
//         selectionID: null,
//         disabled: false,
//         defaultFilter: false,
//         footerMethod: null,
//         formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
//         actions: { dochange: false },
//         auxProp: '',
//         minWidth: '',
//         appWeight: '',
//         isDes: false,
//         many2one: {
//           toTable: '',
//           toField: '',
//           isDropdown: false,
//           customSearch: '',
//           multiConnect: '',
//           fields: []
//         },
//         align: 'left',
//         subQuery: ''
//       },
//       {
//         fieldID: '222301287968935983',
//         field: 'run_level',
//         type: 'smallint',
//         isShow: true,
//         notNull: false,
//         defValue: '0',
//         comment: '',
//         selectionID: null,
//         disabled: false,
//         defaultFilter: false,
//         footerMethod: null,
//         formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
//         actions: { dochange: false },
//         auxProp: '',
//         minWidth: '',
//         appWeight: '',
//         isDes: false,
//         many2one: {
//           toTable: '',
//           toField: '',
//           isDropdown: false,
//           customSearch: '',
//           multiConnect: '',
//           fields: []
//         },
//         align: 'left',
//         subQuery: ''
//       },
//       {
//         fieldID: '222308141738496007',
//         field: 'is_new_row',
//         type: 'bit(1)',
//         isShow: true,
//         notNull: false,
//         defValue: '0',
//         comment: '',
//         selectionID: null,
//         disabled: false,
//         defaultFilter: false,
//         footerMethod: null,
//         formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
//         actions: { dochange: false },
//         auxProp: '',
//         minWidth: '',
//         appWeight: '',
//         isDes: false,
//         many2one: {
//           toTable: '',
//           toField: '',
//           isDropdown: false,
//           customSearch: '',
//           multiConnect: '',
//           fields: []
//         },
//         align: 'left',
//         subQuery: ''
//       }
//     ],
//     rules: [],
//     selbill: [],
//     queryLink: [],
//     action: {},
//     headerGroup: [],
//     charts: [],
//     toolbar: {
//       default: true,
//       insert: true,
//       delete: true,
//       save: true,
//       import: true,
//       export: true,
//       globalSearch: true,
//       refresh: true,
//       edit: true,
//       print: true,
//       audit: false,
//       pasteColumn: false,
//       addon: []
//     },
//     tableDataSetting: { editable: true, autoload: false },
//     messageConfig: {
//       custDefListener: {
//         coordination: '43945627-aa05-11ee-906b-0a2c9e079216'
//       },
//       eventGroup: {},
//       emitActions: { search: [], refresh: [] }
//     },
//     actions: {},
//     permission: [
//       {
//         type: 'button',
//         area: 'toolbar',
//         data: {
//           audit: 1,
//           delete: 1,
//           edit: 1,
//           export: 1,
//           import: 1,
//           insert: 1,
//           pasteColumn: 1,
//           print: 1,
//           save: 1,
//           unaudit: 1
//         }
//       },
//       { type: 'NULL', area: 'default', data: { browse: 1 } },
//       {
//         type: 'columns',
//         area: 'table',
//         data: {
//           f_enabled: 1,
//           is_new_row: 1,
//           run_level: 1,
//           _sys_pms_rule_id: 1,
//           _sys_roleobj_funs_id: 1
//         }
//       }
//     ],
//     mainFun: '_sys_role'
//   };
// };
const getRoleFunRuleConf = () => {
  return {
    name: '_sys_roleobj_funs_rule',
    comment: '',
    status: '',
    isCreated: false,
    tableStyle: {
      showHeader: true,
      showFooter: false,
      showPager: true,
      showToolbar: true,
      border: false
    },
    tableColumns: [
      {
        fieldID: '222301287968935982',
        field: '_sys_roleobj_funs_id',
        type: 'bigint(20)',
        isShow: false,
        notNull: true,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: true,
        defaultFilter: false,
        footerMethod: null,
        formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
        actions: [],
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '_sys_roleobj_funs',
          toField: '_sys_fun_id',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222301287968935985',
        field: '_sys_pms_rule_id',
        type: 'bigint(20)',
        isShow: true,
        notNull: true,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
        actions: [],
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '_sys_publicprocess',
          toField: 'f_name',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: [],
          isFunLayout: true
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222308141738496005',
        field: 'f_enabled',
        type: 'bit(1)',
        isShow: true,
        notNull: false,
        defValue: '0',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
        actions: [],
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222301287968935983',
        field: 'run_level',
        type: 'smallint',
        isShow: true,
        notNull: false,
        defValue: '0',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
        actions: [],
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222308141738496007',
        field: 'is_new_row',
        type: 'bit(1)',
        isShow: false,
        notNull: false,
        defValue: '0',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        footerMethod: null,
        formatter: { type: '', decimal: 0, thousandmark: false, currency: '' },
        actions: [],
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          fields: []
        },
        align: 'left',
        subQuery: ''
      }
    ],
    uniqueIndexes: [
      [
        { id: '222301287968935982', name: '_sys_roleobj_funs_id' },
        { id: '222301287968935985', name: '_sys_pms_rule_id' }
      ]
    ],
    indexes: [
      [{ id: '222301287968935982', name: '_sys_roleobj_funs_id' }],
      [{ id: '222301287968935985', name: '_sys_pms_rule_id' }]
    ],
    rules: [],
    selbill: [],
    queryLink: [],
    action: {},
    headerGroup: [],
    charts: [],
    toolbar: {
      default: true,
      insert: true,
      delete: true,
      save: true,
      import: false,
      export: true,
      globalSearch: true,
      refresh: true,
      edit: true,
      print: true,
      audit: false,
      pasteColumn: false,
      addon: [],
      unaudit: false,
      search: true,
      exportXML: false
    },
    tableDataSetting: { editable: true, autoload: true },
    messageConfig: {
      emitActions: { search: [], refresh: [] },
      custDefListener: {
        coordination: '2B68D60270598CDE',
        search: ['1F444551417D30D0']
      },
      eventGroup: {
        '': {
          custDefListener: { coordination: '6C6F2F6CAEA99577' },
          children: [
            {
              _sys_role: {
                custDefListener: { coordination: '588752E2064583FA' },
                children: [
                  {
                    _sys_role_detail: {
                      custDefListener: { coordination: 'CCE6756AD6D1E346' },
                      children: []
                    }
                  },
                  {
                    _sys_roleobj_funs: {
                      custDefListener: { coordination: '1C2ADA6FEEE59BD5' },
                      children: [
                        {
                          _sys_roleobj_funs_action: {
                            custDefListener: {
                              coordination: 'E987A0B27248CAF2'
                            },
                            children: []
                          }
                        },
                        {
                          _sys_roleobj_funs_rule: {
                            custDefListener: {
                              coordination: '2B68D60270598CDE'
                            },
                            children: []
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    },
    actions: {},
    qbeSearch: {},
    triggerEvent: { groupByField: [] },
    dbType: 'mysql',
    permission: [
      {
        type: 'button',
        area: 'toolbar',
        data: {
          addon: 1,
          audit: 1,
          default: 1,
          delete: 1,
          edit: 1,
          export: 1,
          exportXML: 1,
          globalSearch: 1,
          import: 1,
          insert: 1,
          pasteColumn: 1,
          print: 1,
          refresh: 1,
          save: 1,
          search: 1,
          unaudit: 1
        }
      },
      { type: 'NULL', area: 'default', data: { browse: 1 } },
      {
        type: 'columns',
        area: 'table',
        data: {
          f_enabled: 1,
          is_new_row: 1,
          run_level: 1,
          _sys_pms_rule_id: 1,
          _sys_roleobj_funs_id: 1
        }
      }
    ],
    mainFun: '_sys_role'
  };
};

export {
  I_cmd,
  N_cpms,
  N_oSimpleToolbar,
  T_srv,
  Tcmd,
  Tsrv,
  actToolbarConf,
  funToolbarConf,
  getRoleConf,
  getRoleFunRuleConf,
  ifs,
  ts,
  tvs,
  vue
};
